export class MJHeapCardInfo {

    public HeadUsedCount: number; //为堆头已经被抓取的数量，
    public TailUsedCount: number; //为堆尾已经被抓取的数量
    public AllCount: number; //为该牌墙最大牌数

    //反序列化堆牌信息
    public static deserializeMjHeapCardInfo(headInfoList: Array<object>) {
        let resultList: Array<MJHeapCardInfo> = []
        for (let i = 0; i < headInfoList.length; i++) {
            let cardInfo: MJHeapCardInfo = new MJHeapCardInfo();
            // cardInfo.HeadUsedCount = headInfoList[i].getHeadusedcount();
            // cardInfo.TailUsedCount = headInfoList[i].getTailusedcount();
            // cardInfo.AllCount = headInfoList[i].getAllcount();
            cardInfo.HeadUsedCount = headInfoList[i]["HeadUsedCount"]
            cardInfo.TailUsedCount = headInfoList[i]["TailUsedCount"]
            cardInfo.AllCount = headInfoList[i]["AllCount"]
            resultList[i] = cardInfo;
        }
        return resultList
    }

    public static getChairByTouzi(touzi1: number, touzi2: number, seatNum: number, bankerChair: number) {
        let touziChair: number = (touzi1 + touzi2 - 1) % seatNum
        touziChair = (touziChair + (1 - bankerChair) + seatNum) % seatNum
        return touziChair;
    }

    public getLeftNum() {
        return this.AllCount - this.HeadUsedCount - this.TailUsedCount
    }


}